package com.chwn.harulib.mvp.rx;

import rx.functions.Func1;

/**
 * Created by Myshikin on 2017/1/9.
 */

public class HttpResultFunc<T> implements Func1<HttpResult<T>, T> {
    @Override
    public T call(HttpResult<T> tHttpResult) {
        if (tHttpResult.getCode() != 200) {
            throw new HttpResultException(tHttpResult.getCode(), tHttpResult.getErrorMessage());
        }

        return tHttpResult.getResdata();
    }
}
